fix stream to work with filter groups

Andrew Cantino 11 years ago
parent
commit
ed5cb4ca2f
1 changed files with 2 additions and 2 deletions
  1. 2 2
      bin/twitter_stream.rb

+ 2 - 2
bin/twitter_stream.rb

@@ -52,10 +52,10 @@ end
52 52
 
53 53
 def load_and_run(agents)
54 54
   agents.group_by { |agent| agent.options[:twitter_username] }.each do |twitter_username, agents|
55
-    filter_to_agent_map = agents.map { |agent| agent.options[:filters] }.flatten.uniq.compact.inject({}) { |m, f| m[f] = []; m }
55
+    filter_to_agent_map = agents.map { |agent| agent.options[:filters] }.flatten.uniq.compact.map(&:strip).inject({}) { |m, f| m[f] = []; m }
56 56
 
57 57
     agents.each do |agent|
58
-      agent.options[:filters].uniq.map(&:strip).each do |filter|
58
+      agent.options[:filters].flatten.uniq.compact.map(&:strip).each do |filter|
59 59
         filter_to_agent_map[filter] << agent
60 60
       end
61 61
     end